import { useState } from "react";

const StateDemo = () => {
  const [count, setCount] = useState(0);
  function add() {
    // let result = count + 1;
    // setCount(result);
    // console.log("result ", result);
    setCount(count + 1);
    console.log("count ", count);
  }
  return (
    <div>
      <button onClick={add}>add {count}</button>
    </div>
  );
};
export default StateDemo;
